package sk.tuke.android4all.dialer;

import android.app.Activity;
import android.app.FragmentTransaction;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.content.Intent;
import sk.tuke.android4all.controls.CustomFragment;

public class DialerActivity extends Activity {
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_dialer);		
		this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT);
		
        if (savedInstanceState == null) {
            FragmentTransaction t = getFragmentManager().beginTransaction();
            t.add(R.id.container, new DialerFragment(this), DialerFragment.class.getName()).commit();
        }
	}
	
	@Override
	public void onActivityResult(int requestCode, int resultCode,Intent data){
		if(resultCode == RESULT_OK){
			((CustomFragment) getFragmentManager().findFragmentByTag(data.getExtras().getString("caller"))).proceedReturnedResult(requestCode, resultCode, data);
		}
	}
	
}
